package com.meilele.dao.hongdian;

import com.meilele.entity.hongdian.ThiCaseImg;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
public interface ThiCaseImgMapper {
    @Delete({
        "delete from thi_case_img",
        "where img_id = #{imgId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer imgId);

    @Insert({
        "insert into thi_case_img (img_id, case_img, ",
        "case_id)",
        "values (#{imgId,jdbcType=INTEGER}, #{caseImg,jdbcType=VARCHAR}, ",
        "#{caseId,jdbcType=INTEGER})"
    })
    int insert(ThiCaseImg record);

    int insertSelective(ThiCaseImg record);

    @Select({
        "select",
        "img_id, case_img, case_id",
        "from thi_case_img",
        "where img_id = #{imgId,jdbcType=INTEGER}"
    })
    @ResultMap("com.meilele.dao.hongdian.ThiCaseImgMapper.BaseResultMap")
    ThiCaseImg selectByPrimaryKey(Integer imgId);

    int updateByPrimaryKeySelective(ThiCaseImg record);

    @Update({
        "update thi_case_img",
        "set case_img = #{caseImg,jdbcType=VARCHAR},",
          "case_id = #{caseId,jdbcType=INTEGER}",
        "where img_id = #{imgId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ThiCaseImg record);
}